package demo5;

public class Student {
    public String name;
    public int age;
    public static String school;
    public static String city;

    static{
        city = "Hong Kong";
        System.out.println("静态代码块1被执行...");
    }

    static{
        school = "BitUniversity";
        System.out.println("静态代码块2被执行...");
    }

    {
        name = "kay";
        age = 16;
        System.out.println("实例代码块1被执行...");
    }

    {
        name = "ben";
        age = 18;
        System.out.println("实例代码块2被执行...");
    }

    public Student(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("带两个参数的构造方法被执行了");
    }

    public Student(){
        System.out.println("不带参数的构造方法被执行了");
    }

    public void doHomework(){
        System.out.println(this.name + "正在做作业...");
    }

}
